<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 17-2-23
 * Time: 上午11:20
 */


$ref = new stdClass();
$ref->{'ref-type'} = 'Journal Article';
echo $ref->{'ref-type'};

var_dump($arr = (array)($ref));
echo $arr['ref-type'];
echo $arr{'ref-type'};


echo PHP_EOL;
class Stu{
    public $name;
    public static $name2;

    function stu(){
        echo "init";
    }
    function __construct()
    {
        echo 'init2';
    }

    public function getName(){
        return $this->name;
    }

    public static function getName2(){
        //$
        return self::$name2.PHP_EOL;
    }

    function __call($name, $arguments)
    {
        if (!isset($this->$name)){
            $this->$name = $name;
        }
    }
    function __get($name)
    {
        return $name;
    }
}

$stu = new Stu();
Stu::$name2 = "Hello World";
echo Stu::getName2();


$stu->id = 10000;
echo $stu->id;

$stu->getId = function (){
    return 111111;
};

echo $stu->getId();